package licode.unisop.client.service.impl;

import licode.unisop.client.utils.SopException;
import licode.unisop.client.utils.SopResult;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * 异常方法拦截
 *
 * @author licode
 */
@RestControllerAdvice
public class SopExceptionHandler {
    @ExceptionHandler(SopException.class)
    public SopResult<Object> uniExceptionHandler(SopException e) {
        e.printStackTrace();
        return SopResult.fail(e.getCode(), e.getMessage());
    }
}
